#!/usr/bin/env python
import logging,os
log_dir=os.path.dirname(os.path.dirname(__file__)) + '/log/'


logger = logging.getLogger('SHTools')
logger.setLevel(logging.DEBUG)

ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
fh = logging.FileHandler(log_dir + "operation.log")
fh.setLevel(logging.DEBUG)

ch_formatter = logging.Formatter('%(levelname)s - %(message)s')
fh_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

ch.setFormatter(ch_formatter)
fh.setFormatter(fh_formatter)

logger.addHandler(ch)
logger.addHandler(fh)